<?php
/**
 * Created by PhpStorm.
 * User: apple
 * Date: 2018/7/25
 * Time: 上午6:53
 */
namespace PddWechat\Models\Share\Dao;
use Dai\Framework\Base\BaseDao;
use PddWechat\Models\Share\DataObject\SharePosDo;

/**
 * Class SharePosDao
 * @dataObject(\PddWechat\Models\Share\DataObject\SharePosDo)
 * @package PddWechat\Models\Share\Dao
 */
class SharePosDao extends BaseDao
{
    public function insert(SharePosDo $sharePosDo)
    {
        $sharePosDo->id = $this->execute("user.share_pos.insert",$sharePosDo);
        return $sharePosDo;
    }


    public function selectShareInfoByInvIdAndRecomId($invateOpenId,$recommendOpenId)
    {
        $param = [
            'invateOpenId' => $invateOpenId,
            'recommendOpenId' => $recommendOpenId,
            'select' => '*'
        ];
        $res = $this->execute("user.share_pos.select_by_invateid_and_recommandid", $param);
        if( count($res) > 0 ) {
            /** @var SharePosDao $ret */
            $ret = $this->trimBase($res[0]);
            return $ret;
        }
        return null;
    }
}